# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

import logging
_logger = logging.getLogger(__name__)

from odoo import http, api
#from odoo.http import request
#from odoo.service import security
#from odoo import SUPERUSER_ID, registry

class UserJsonApi(http.Controller):

    @http.route('/json/user/register',type='json', auth='none', cors='*', csrf=False )
    def register(self,db,login,password):
        with registry(db).cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            return env['res.users'].register(login,password)

    @http.route('/json/user/reset/password',type='json', auth='none', cors='*', csrf=False )
    def reset_psw(self,db,login,password):
        with registry(db).cursor() as cr:
            env = api.Environment(cr, SUPERUSER_ID, {})
            return env['res.users'].reset_new_password(login,password)


